<template>
	<view class="filter-tip-bar">
		<view class="filter-tip-bar__item overflow" :class="active === 0 ? 'active' : ''" @click="getCurrentItem(0)">{{ destName }}</view>
		<view class="filter-tip-bar__item" :class="active === 1 ? 'active' : ''" @click="getCurrentItem(1)">{{ sortName }}</view>
		<view class="filter-tip-bar__item" :class="active === 2 ? 'active' : ''" @click="getCurrentItem(2)">{{ filterName }}</view>
	</view>
</template>

<script>
	/**
	 * 列表筛选栏
	 * 
	 */
	export default {
		name: 'stFilterTipBar',
		props: {
			active: {
				type: Number,
				default: -1
			},
			destName: {
				type: String,
				default: '目的地'
			},
			sortName: {
				type: String,
				default: '综合排序'
			},
			filterName: {
				type: String,
				default: '筛选'
			}
		},
		data() {
			return {
				
			};
		},
		methods: {
			getCurrentItem(index){
				this.$emit('unfold',index)
			}
		}
	}
</script>

<style lang="scss">
	
	.filter-tip-bar {
		
		position: relative;
		z-index: 998;
		display: flex;
		box-shadow: 0 20rpx 30rpx rgba(0, 0, 0, 0.1);
		background: #fff;
		margin-top: -5rpx;
		&,&__item{
			height: 84rpx;
		}
		&__item {
			flex: 0 0 33.333333%;
			line-height: 84rpx;
			text-align: center;
			font-size: $uni-font-size-sm;
			font-weight: bold;
			&:after {
				content: '';
				display: inline-block;
				width: 0;
				height: 0;
				border-top: 8rpx solid #535353;
				border-left: 8rpx solid transparent;
				border-right: 8rpx solid transparent;
				vertical-align: middle;
				margin: 2rpx 0 0 8rpx;
				transition: all 0.3s;
			}
			&.active {
				color: #2dbb55;
				&:after {
					border-top-color: #2dbb55;
					margin-top: -4rpx;
					transform: rotate(180deg);
				}
			}
		}
	}
	.overflow{
		padding: 0 24rpx;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
		box-sizing: border-box;
	}
</style>
